import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wch/widget/padding_widget.dart';

import '../constant/resource_constant.dart';
//
//文本组件
//
class BigTitleText extends StatelessWidget {
  BigTitleText(this.title, {Key? key, this.textColor = F1TextColor}) : super(key: key);
  final String title;
  final Color textColor;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      style: const TextStyle(
          color: F1TextColor,
          fontSize: bigTextSize,
          decoration: TextDecoration.none),
    );
  }
}

class MyText extends StatelessWidget {
  const MyText(this.title, {Key? key, required this.color, required this.fontSize, this.overflow})
      : super(key: key);

  final String title;
  final Color color;
  final double fontSize;
  final TextOverflow? overflow;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      overflow: overflow ?? TextOverflow.fade,
      style: TextStyle(
          color: color, fontSize: fontSize.w, decoration: TextDecoration.none),
    );
  }
}

class BoldText extends StatelessWidget {
  const BoldText(this.title, {super.key, required this.fontSize});

  final String title;
  final double fontSize;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      overflow:TextOverflow.ellipsis,
      style: TextStyle(
          color: const Color(0xFF424242), fontSize: fontSize.w, fontWeight: FontWeight.w500, decoration: TextDecoration.none),
    );
  }
}

class F19TitleText extends StatelessWidget {
  const F19TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      textAlign: TextAlign.center,
      style: TextStyle(
        height: 1.1,
          color: color, fontSize: f19TextSize, decoration: TextDecoration.none),
    );
  }
}
class F18TitleText extends StatelessWidget {
  const F18TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      style: TextStyle(
          color: color, fontSize: f18TextSize, decoration: TextDecoration.none),
    );
  }
}
class F17TitleText extends StatelessWidget {
  const F17TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      style: TextStyle(
          color: color, fontSize: f17TextSize, decoration: TextDecoration.none),
    );
  }
}
class F16TitleText extends StatelessWidget {
  const F16TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      style: TextStyle(
          color: color, fontSize: f16TextSize, decoration: TextDecoration.none),
    );
  }
}

class F15TitleText extends StatelessWidget {
  const F15TitleText(this.title, {Key? key, required this.color, this.overflow})
      : super(key: key);

  final String title;
  final Color color;
  final TextOverflow? overflow;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      overflow: overflow ?? TextOverflow.fade,
      style: TextStyle(
          color: color, fontSize: f15TextSize, decoration: TextDecoration.none),
    );
  }
}

class F14TitleText extends StatelessWidget {
  const F14TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      overflow: TextOverflow.ellipsis,
      style: TextStyle(
          color: color, fontSize: f14TextSize, decoration: TextDecoration.none),
    );
  }
}
class F13TitleText extends StatelessWidget {
  F13TitleText(this.title, {Key? key, required this.color, this.isAlignCenter = false})
      : super(key: key);

  final String title;
  final Color color;
  bool isAlignCenter = false;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      textAlign: isAlignCenter ? TextAlign.center : TextAlign.left,
      style: TextStyle(
          color: color, fontSize: f13TextSize, decoration: TextDecoration.none),
    );
  }
}
class F12TitleText extends StatelessWidget {
  const F12TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      style: TextStyle(
          color: color, fontSize: f12TextSize, decoration: TextDecoration.none),
    );
  }
}

class F11TitleText extends StatelessWidget {
  const F11TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      style: TextStyle(
          color: color, fontSize: f11TextSize, decoration: TextDecoration.none),
    );
  }
}

class F10TitleText extends StatelessWidget {
  const F10TitleText(this.title, {Key? key, required this.color})
      : super(key: key);

  final String title;
  final Color color;

  @override
  Widget build(BuildContext context) {
    return Text(
      title,
      style: TextStyle(
          color: color, fontSize: f10TextSize, decoration: TextDecoration.none),
    );
  }
}

class UnderLineText extends StatefulWidget {
  UnderLineText(this.title, {Key? key, this.isSelect = false, this.selectColor = F1TextColor, this.normalColor = contentTextColor, this.callback, this.fontSize = 15
  }) : super(key: key);

  final String title;

  final Color selectColor;

  final Color normalColor;

  final bool isSelect;

  double fontSize = 15;

  Function? callback;

  @override
  State<UnderLineText> createState() => _UnderLineTextState();
}

class _UnderLineTextState extends State<UnderLineText> {

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        if (widget.callback != null) {
          widget.callback!();
        }
      },
      child: Column(
        children: [
          Text(
            widget.title,
            style: TextStyle(
                color: widget.isSelect ? widget.selectColor : widget.normalColor, fontSize: f15TextSize.w, decoration: TextDecoration.underline),
          ),
          VerPadding(2.w),
        ],
      ),
    );
  }


}
